home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
- From: annoying@usa.pipeline.com(Zachary Hartnett)
- Newsgroups: comp.lang.c++
- Subject: Re: Problem with Borland C++ v4.52
- Date: 26 Mar 1996 17:53:58 GMT
- Organization: Pipeline USA
- Message-ID: <4j9avm$nh2@news1.h1.usa.pipeline.com>
- References: <4j973t$ctm@newsbf02.news.aol.com>
- NNTP-Posting-Host: 38.8.120.16
- X-PipeUser: annoying
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Zachary Hartnett)
- X-Newsreader: Pipeline v3.5.0
-
- /*
- roytoo@aol.com wrote:
-
- I am having a runtime problem with Borland C++ v4.52. When I try to input
- a real number (i.e. 12.5) using cin >> to a variable defined as a double,
- float or long double, I get a "floating point: overflow" error. This
- problem disappears if I input numbers in the format: 1.25e1. However, if
- i use the format: 12.5e0, the runtime error occurs again.
- */
-
- #include <iostream.h>
-
- void main(void)
- {
- float valFloat;
- double valDouble;
- long double valLDouble;
-
- cout << "Input float value:";
- cin >> valFloat;
-
- cout << "Input double value:";
- cin >> valDouble;
-
- cout << "Input long double value:";
- cin >> valLDouble;
-
- cout << "float: " << valFloat << '\n'
- << "double: " << valDouble << '\n'
- << "long double:" << valLDouble;
- }
-
- /*
- G:\>bcc t
- Borland C++ 4.52 Copyright (c) 1987, 1994 Borland International
- t.cpp:
- Turbo Link Version 7.1.30.1. Copyright (c) 1987, 1996 Borland
- International
-
- G:\>t
- Input float value:45.5
- Input double value:1e+23
- Input long double value:56
- float: 45.5
- double: 1e+23
- long double:56
- G:\>
- */
-
- // I'm not sure where your problem lies... Does this program work?
- // If you are using printf or scanf, don't forget the & (reference
- operator).
-